/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.anniversary.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.base.BaseEntity;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @website https://el-admin.vip
* @description /
* @author Jiayin Wei
* @date 2020-07-28
**/
@Entity
@Data
@Table(name="gzmu_ann_alumni")
public class Alumni extends BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "编号ID")
    private Long id;

    @Column(name = "name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(name = "gender")
    @ApiModelProperty(value = "性别")
    private String gender;

    @Column(name = "birth_date")
    @ApiModelProperty(value = "出生年月")
    private Timestamp birthDate;

    @Column(name = "nation_id")
    @ApiModelProperty(value = "民族ID")
    private Long nationId;

    @Column(name = "political_id")
    @ApiModelProperty(value = "政治面貌ID")
    private Long politicalId;

    @Column(name = "phone")
    @ApiModelProperty(value = "联系电话")
    private String phone;

    @Column(name = "work_unit")
    @ApiModelProperty(value = "工作单位")
    private String workUnit;

    @Column(name = "work_department")
    @ApiModelProperty(value = "任职部门")
    private String workDepartment;

    @Column(name = "positional")
    @ApiModelProperty(value = "职务")
    private String positional;

    @Column(name = "job")
    @ApiModelProperty(value = "职务")
    private String job;

    @Column(name = "brief")
    @ApiModelProperty(value = "简介")
    private String brief;

    @Column(name = "photo_path")
    @ApiModelProperty(value = "照片路径")
    private String photoPath;

    @Column(name = "sort")
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @Column(name = "remark")
    @ApiModelProperty(value = "备注")
    private String remark;

    @Column(name = "is_enable")
    @ApiModelProperty(value = "是否启用")
    private Boolean isEnable;

    public void copy(Alumni source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}